cmake_minimum_required(VERSION 3.5.0)
project(we VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY D:/Work/Dev/2025/web/liguowu/electron-cesium/src/renderer/src/we-api/we-assets)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY F:/Dev/2025/web/liguowu/electron-cesium/src/renderer/src/we-api/we-assets)

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s ENVIRONMENT=web -s ASSERTIONS -s ALLOW_MEMORY_GROWTH=1 -O3 --bind -s EXPORTED_RUNTIME_METHODS=['cwrap','ccall']")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s ENVIRONMENT=web -s ASSERTIONS -s ALLOW_MEMORY_GROWTH=1 -O3 --bind")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/zlib)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../src/3rdparty)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../src/Core)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCesium)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain)
message(${CMAKE_CURRENT_SOURCE_DIR})


SET(TARGET_SRC
	main.cpp
	StreamLine.cpp
    IsoBandPolygons.cpp
	IsoBandUtil.cpp
	GifEncode.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/zlib/adler32.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/compress.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/crc32.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/deflate.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzclose.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzlib.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzread.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzwrite.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/inflate.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/infback.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/inftrees.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/inffast.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/trees.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/uncompr.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zutil.c
	${CMAKE_CURRENT_SOURCE_DIR}/zlib/adler32.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/compress.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/crc32.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/deflate.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzclose.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzlib.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzread.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/gzwrite.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/inflate.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/infback.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/inftrees.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/inffast.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/trees.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/uncompr.c
    ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zutil.c

	
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/src/StringUtil.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/src/ZipUtil.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/BZip2.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/blocksort.c
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/bzlib.c
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/compress.c
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/crctable.c
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/decompress.c
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/huffman.c
	${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/zip/bz2/randtable.c

    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/src/GifUtil.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/gif/cgif.c
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/gif/cgif_raw.c
    ${CMAKE_CURRENT_SOURCE_DIR}/../src/Core/OCMain/gif/cgif_rgb.c
)

add_executable(we ${TARGET_SRC})
target_compile_definitions(we PRIVATE _WeWasm)


